home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group98a.txt / 000074_icon-group-sender _Mon Mar 2 12:49:21 1998.msg < prev    next >
Internet Message Format  |  2000-09-20  |  3KB

  1. Return-Path: <icon-group-sender>
  2. Received: from kingfisher.CS.Arizona.EDU (kingfisher.CS.Arizona.EDU [192.12.69.239])
  3.     by baskerville.CS.Arizona.EDU (8.8.7/8.8.7) with SMTP id MAA19841
  4.     for <icon-group-addresses@baskerville.CS.Arizona.EDU>; Mon, 2 Mar 1998 12:49:20 -0700 (MST)
  5. Received: by kingfisher.CS.Arizona.EDU (5.65v4.0/1.1.8.2/08Nov94-0446PM)
  6.     id AA03042; Mon, 2 Mar 1998 12:49:20 -0700
  7. Date: Mon, 2 Mar 1998 09:35:34 -0800
  8. From: kwalker@sfo.harbinger.com (Ken Walker)
  9. Message-Id: <199803021735.JAA19946@varda.premenos.com>
  10. To: icon-group@optima.CS.Arizona.EDU
  11. Subject: Re: Translation into C
  12. Mime-Version: 1.0
  13. Content-Type: text/plain; charset=us-ascii
  14. Content-Transfer-Encoding: 7bit
  15. Content-Md5: BTPFMQXQOZEgPScV7e5NjQ==
  16. Errors-To: icon-group-errors@optima.CS.Arizona.EDU
  17. Status: RO
  18. Content-Length: 2167
  19.  
  20. I'd like to start by stepping back and looking at what it means
  21. for a program to be interpreted. In some sense, all code is interpreted;
  22. iterpretation can be done at several levels:
  23.  
  24.    1) keep program as text and interpret with a software
  25.       interpreter
  26.    
  27.    2) parse program and interpret the syntax tree, symbol table,
  28.       etc. with a software interpreter
  29.    
  30.    3) convert program to byte code for an abstract machine and
  31.       interpret with a software interpreter
  32.      
  33.    4) convert program to machine code and interpret with a hardware
  34.       interpeter (CPU)
  35.       
  36. The Icon interpreter uses method 3 and the Icon compiler uses method 4.
  37.       
  38. Clearly software interpeters have some overhead, but with Icon
  39. and some other "interpreted" languages, the software interpreter
  40. loop is only a part of the overhead. Much of the cost comes from the
  41. generality built into the run time support system for the language.
  42. The Icon compiler is able to do some tailoring of the run time system
  43. using information from type inferencing [it can typically determine
  44. a unique type for 80% of the operands to build-in operations and
  45. eliminate corresponding type checks]. If you study the code produced
  46. by the compiler, it is not hard to find places were more optimizations
  47. can be done. For example, the compiler makes no attempt to tailor
  48. data structures to the needs of the program. Lists are always doublely
  49. ended queques regardless of how you use them.
  50.  
  51. Simply translating Icon programs into C, helps some, but you need a
  52. lot of sophisticated analysis and clever optimization if you want
  53. to produce a C program that comes anywhere near a hand-coded one.
  54. Even then, the C programmer may have information about the problem
  55. domain that cannot be deduced from the Icon code by any analysis.
  56. The C programs produced by the current Icon compiler run considerably
  57. faster than interpreted program but appear to have a ways to go to match
  58. hand-coded C. If someone has time, it would be interesting to compare
  59. compiled Icon programs to hand-coded C [unfortunately, I've never
  60. found the time...].
  61.  
  62. Ken Walker, kwalker@sfo.harbinger.com
  63. Harbinger Coporation, Concord, Ca. 94520
  64.  
  65.  
  66.